package com.arron.algorithm.leetcodetop100.数组.矩阵;

public class 搜索二维矩阵 {


    public boolean searchMatrix(int[][] matrix, int target) {
        for (int[] ints : matrix) {

            if (search(ints,target)){
                return true;
            }

        }
        return false;
    }
    public boolean search(int[]  nums,int target){

        int left = 0;
        int right = nums.length-1;
        while (left<= right){
            int mid = left+(right-left)/2;

            if (nums[mid]== target){
                return true;
            }else if (nums[mid] <target){
                left = mid +1;
            }else {
                right = mid -1;
            }
        }

        return false;
    }


}
